package tech.kpretty.safe;

import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;

public class NotSafeDemo {
    public static void main(String[] args) {
        //List<String> list = new ArrayList<>();
        //List<String> list1 = new Vector<>();
        //List<String> list2 = Collections.synchronizedList(new ArrayList<>());
        List<String> list3 = new CopyOnWriteArrayList<>();

        for (int i = 0; i < 30; i++) {
            new Thread(() -> {
                list3.add(UUID.randomUUID().toString().substring(0, 6));
                System.out.println(list3);
            }, String.valueOf(i)).start();
        }
    }
}
